*------------------------------------------------------------------------------*

**# Set path

*------------------------------------------------------------------------------*

global code_dir="<add path to your working directory>/code"

*------------------------------------------------------------------------------*

**# Replication files for ~~~~~~~~~ Grade 8 SIMCE score regressions ~~~~~~~~~ 	

*------------------------------------------------------------------------------*
/*	
	Please Note: 
	Student data are confidential and can be retrieved from MINEDU. As a result, the data are not included in the replication package. All syntax files that replicate the results, if one retrieves the score data, are included in the replication package and are as below.
*/

do "$code_dir/cleanup_stacked_simce_8b4b_merged_sned.do"	
	/*
		do-file calls to do:
						do "$code_dir/cleanup_simce_b8_2015.do"
						do "$code_dir/cleanup_simce_b8_2013.do"
						do "$code_dir/cleanup_simce_b8_2011.do"

						do "$code_dir/cleanup_simce_b4_2011.do"
						do "$code_dir/cleanup_simce_b4_2009.do"
						do "$code_dir/cleanup_simce_b4_2007.do"

						do "$code_dir/cleanup_snedforsimce.do"

	*/




*	Summary statistics:
*	-------------------


**# Table A.1: Descriptive statistics of student variables
do "$code_dir/sumstats_8b4_TA1.do"


*	Balance checks:
*	---------------

**# Table A.4: Baseline checks for both grade 6 and grade 8 cohorts, separately
do "$code_dir/pre_8b4_main_TA4.do"

**# Figure A.4: Student baseline variables' discontinuity plots, Grade 8 cohorts
do "$code_dir/pre_8b4_graphs_FigA4.do"



*	Regression Analysis:
*	--------------------

**# Table 4: The Effect of SNED on Grade 8 Cohorts' Scores
do "$code_dir/post_8b4_main_T4.do"

**# Table A.6: The Effect of SNED on Grade 8 Cohorts' Scores for Incumbent Students
do "$code_dir/post_8b4_incumbent_TA6.do"

**# Table A.8: The Effect of SNED on Student Sorting for Grade 8 Cohorts
do "$code_dir/post_8b4_sorting_TA8.do"

**# Table A.10: Heterogeneous Effects, Grade 8 Cohorts
do "$code_dir/post_8b4_extval_TA10.do"



**# Figure A.7: Student outcome discontinuity plots, Grade 8 cohorts
do "$code_dir/post_8b4_graphs_FigA7.do"

**# Figure A.10: Bandwidth Sensitivity, Grade 8 Cohorts	
do "$code_dir/post_8b4_bwsensitivity_FigA10.do"

	

	
*------------------------------------------------------------------------------*

**# Replication files for ~~~~~~~~~ Grade 6 SIMCE score regressions ~~~~~~~~~	

*------------------------------------------------------------------------------*
/*	
	Please Note: 
	------------
	Student data are confidential and can be retried from MINEDU. Hence, the data are not included in the replication package. All syntax files that replicate the results, if one retrieves the score data, are included in the replication package and are as below.
*/



* Cleans up the test score data, stacks them up and links them to the SNED data

do "$code_dir/cleanup_stacked_simce_6b4b_merged_sned.do"	

	/*
		This do file calls to do:
						do "$code_dir/cleanup_simce_b6_2015.do"
						do "$code_dir/cleanup_simce_b6_2013.do"

						do "$code_dir/cleanup_simce_b4_2011.do"
						do "$code_dir/cleanup_simce_b4_2009.do"

						do "$code_dir/cleanup_snedforsimce.do"

	*/


*	Summary statistics:
*	-------------------

**# Table A.1: Descriptive statistics of student variables
do "$code_dir/sumstats_6b4_TA1.do"


*	Balance checks:
*	---------------		

**# Table A.4: Baseline checks for both grade 6 and grade 8 cohorts, separately
do "$code_dir/pre_6b4_main_FigA3"

**# Figure A.3: Student baseline variables' discontinuity plots, Grade 6 cohorts
do "$code_dir/pre_6b4_main_TA4.do" 


*	Regression Analysis:
*	--------------------

**# Table 5: The Effect of SNED on Grade 6 Cohorts' Scores
do "$code_dir/post_6b4_main_T5.do"

**# Table A.7: The effect of SNED on Grade 6 Cohorts' Scores for Incumbent Students
do "$code_dir/post_6b4_incumbent_TA7.do"

**# Table A.9: The Effect of SNED on Student Sorting for Grade 6 Cohorts
do "$code_dir/post_6b4_sorting_TA9.do"

**# Table A.11: Heterogeneous Effects of SNED on Grade 6 Cohorts' Scores
do "$code_dir/post_6b4_extval_TA11.do"


**# Figure A.6: Student outcome  discontinuity plots, Grade 6 cohorts
do "$code_dir/post_6b4_graphs_FigA6.do"	
	
**# Figure A.9: Bandwidth sensitivity, Grade 6 cohorts
do "$code_dir/post_6b4_bwsensitivity_FigA9.do"

	

	
*------------------------------------------------------------------------------*

**# Replication files for ~~~~~~~~~ Teacher analysis ~~~~~~~~~ 	

*------------------------------------------------------------------------------*

do "$code_dir/cleanup_t_s_est_samples.do"


*	Summary statistics:
*	-------------------


**# Table A.2: Descriptive statistics for teacher variables

do "$code_dir/sumstats_t_s_TA2.do"


*	Balance checks:
*	---------------		
	
**# Table  A.5: Baseline check for teacher variables
do "$code_dir/pre_t_s_main_TA5.do"

**# Figure A.5: Teachers' baseline variables discontinuity plots
do "$code_dir/pre_t_s_graphs_FigA5.do"
	

*	Regression Analysis:
*	--------------------


**# Table 6: Probability to win the SNED in the next round
do "$code_dir/post_s_winagain_T6.do"
	
**# Table 7: Effect of SNED on teacher outcomes, teacher-level analysis
do "$code_dir/post_t_main_T7.do"

**# Table 8: Effect of SNED on teacher outcomes, school-level analysis
do "$code_dir/post_s_main_T8.do"

**# Table A.12: Heterogeneous Effects of SNED on Teacher Outcomes I, Teacher-Level Analysis
do "$code_dir/post_t_extval_TA12.do"

**# Table A.13: Effect of SNED on Teacher Outcomes II, School-Level Analysis
do "$code_dir/post_s_extval_TA13.do"



**# Figure A.8: Teacher outcome discontinuity plots (t & s level)
do "$code_dir/post_t_s_graphs_FigA8.do"

**# Figure A.11: Bandwidth sensitivity, teacher variables I
do "$code_dir/post_t_bwsensitivity_FigA11.do"

**# Figure A.12: Bandwidth sensitivity, teacher variables II
do "$code_dir/post_s_bwsensitivity_FigA12.do"

	

	
*------------------------------------------------------------------------------*

**# Replication files for the ~~~~~~~~~ SNED index ~~~~~~~~~	

*------------------------------------------------------------------------------*
/*
	Figure 1: Plots of the probability of winning against the centered assignment variable
	---------
	Figure 2: Histograms of the assignment variable
	---------
	Figure 3: McCrary (2008) test plots of assignment variable
	---------
	Figure 4: Density of evaluation index and homogeneous group cutoffs
	---------
*/
**# Table 3 + Figures 1-4 : McCrary Test p-values
do "$code_dir/index_internalvalidity_T3+Fig1-4.do"

**# Table A.3: Homogeneous group-level summary statistics of cutoffs and assignment variable
do "$code_dir/index_HGsumstats_TA3.do"

 
*---------------------------------------------------------------------------*END


